package lgs.hm.aop;

import java.lang.reflect.Array;
import java.util.Arrays;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class CoolBoy {
	
	@Around("lgs.hm.aop.ShuaiGe.haha()")
	public Object around(ProceedingJoinPoint pjp) {
		System.out.println("前置通知");
		Object[] args = pjp.getArgs();
		System.out.println(Arrays.toString(args));
		try {
			Object r = pjp.proceed(args); //让目标方法执行
			System.out.println("返回值通知");
			return r;  
		} catch (Throwable e) {
			System.out.println("异常通知");
			// TODO Auto-generated catch block
		} 
		System.out.println("后置通知");
		return 188;  //目标方法不会被调用。
	}

}
